package com.example.datn.adapter;

import java.util.List;

import com.example.datn.R;
import com.example.datn.objects.RssObject;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;



public class NewsAdapter extends ArrayAdapter<RssObject>{

	private Context context;
	private List<RssObject> item;
	private int ivIcon;
	public NewsAdapter(Context context, int ivIcon, List<RssObject> item) {
		super(context, ivIcon, item);
this.context=context;
this.item=item;
this.ivIcon=ivIcon;


	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=(LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE);

View rowView=inflater.inflate(R.layout.newsrrs, parent,false);
ImageView iv=(ImageView) rowView.findViewById(R.id.ivicon);
TextView tv=(TextView) rowView.findViewById(R.id.tvNews);
		

//iv.setImageResource(Variable.ICONS[ivIcon]);
iv.setImageResource(ivIcon);
tv.setText(item.get(position).getTitle());

return rowView;
	}

}

